import { rules } from '/@/utils/helper/validator';
export const columns = [
    {
        title: '手机号',
        dataIndex: 'username',
        width: 100,
    },
    {
        title: '姓名',
        dataIndex: 'realname',
        width: 100,
    },
    // {
    //   title: '昵称',
    //   dataIndex: 'nickname',
    //   width: 120,
    // },
    // {
    //   title: '头像',
    //   dataIndex: 'avatar',
    //   width: 120,
    //   customRender: render.renderAvatar,
    // },
    {
        title: '角色',
        dataIndex: 'middleOptAuth',
        width: 80,
        slots: { customRender: 'middleOptAuthSlot' },
    },
    {
        title: '状态',
        dataIndex: 'status',
        width: 80,
        filters: [
            { text: '正常', value: '1' },
            { text: '冻结', value: '0' },
        ],
        filterMultiple: false,
        slots: { customRender: 'statusSlot' },
    },
    {
        title: '创建时间',
        sorter: true,
        dataIndex: 'createTime',
        width: 100,
    },
];
export const recycleColumns = [
    {
        title: '手机号',
        dataIndex: 'username',
        width: 100,
    },
    {
        title: '姓名',
        dataIndex: 'realname',
        width: 100,
    },
    // {
    //   title: '昵称',
    //   dataIndex: 'nickname',
    //   width: 120,
    // },
    {
        title: '角色',
        dataIndex: 'middleOptAuth',
        width: 80,
        slots: { customRender: 'middleOptAuthSlot' },
    },
];
export const searchFormSchema = [
    {
        label: '手机号',
        field: 'username',
        component: 'JInput',
        colProps: { span: 4 },
    },
    {
        label: '姓名',
        field: 'realname',
        component: 'JInput',
        colProps: { span: 4 },
    },
    {
        label: "创建时间",
        field: "createTime",
        component: 'RangePicker',
        componentProps: {
            showTime: true,
        },
        colProps: { span: 14 },
    },
];
export const formSchema = [
    {
        label: '',
        field: 'id',
        component: 'Input',
        show: false,
    },
    {
        label: '手机号',
        field: 'username',
        component: 'Input',
        dynamicRules: ({ model, schema }) => {
            return [
                { required: true, message: '请输入手机号', },
                { ...rules.duplicateCheckRule('sys_user', 'username', model, schema, true)[0] },
                { pattern: /^1[3|4|5|7|8|9][0-9]\d{8}$/, message: '手机号码格式有误' },
            ];
        },
    },
    {
        label: '姓名',
        field: 'realname',
        required: true,
        component: 'Input',
    },
    // {
    //   label: '昵称',
    //   field: 'nickname',
    //   required: true,
    //   component: 'Input',
    // },
    {
        label: '登录密码',
        field: 'password',
        component: 'StrengthMeter',
        rules: [
            {
                required: true,
                message: '请输入登录密码',
            },
        ],
    },
    {
        label: '确认密码',
        field: 'confirmPassword',
        component: 'InputPassword',
        dynamicRules: ({ values }) => rules.confirmPassword(values, true),
    },
    // {
    //   label: '头像',
    //   field: 'avatar',
    //   component: 'JImageUpload',
    //   componentProps: {
    //     fileMax: 1,
    //     bizPath: 'user/pic',
    //   },
    // },
    // {
    //   label: "角色绑定",
    //   field: 'middleOptAuth',
    //   component: 'JDictSelectTag',
    //   componentProps:{
    //     dictCode: "caishui_m_opt_role"
    //   },
    //   required: true,
    // },
    {
        label: '公司绑定',
        field: 'businessIds',
        component: 'JSelectMultiple',
        componentProps: {
        // dictCode: "caishui_business,name,id,type=1 and is_default=0 and isnull(channel_business_id)",
        },
    },
    // {
    //   label: '渠道绑定',
    //   field: 'channelBusinessId',
    //   component: 'JDictSelectTag',
    //   componentProps:{
    //     dictCode: "caishui_business,name,id,type=3",
    //   },
    //   ifShow: ({ values }) => values.middleOptAuth == 2,
    //   required: true,
    // },
    // {
    //   label: '用户类型',
    //   field: 'middleUserType',
    //   component: 'RadioGroup',
    //   defaultValue: 1,
    //   componentProps: ({ formModel }) => {
    //     return {
    //       options: [
    //         { label: '管理员', value: 1, key: '1' },
    //         { label: '员工', value: 2, key: '2' },
    //       ],
    //     };
    //   },
    //   ifShow: ({ values }) => values.middleOptAuth == 2,
    //   required: true,
    // },
];
export const formPasswordSchema = [
    {
        label: '用户账号',
        field: 'username',
        component: 'Input',
        componentProps: { readOnly: true },
    },
    {
        label: '登录密码',
        field: 'password',
        component: 'StrengthMeter',
        componentProps: {
            placeholder: '请输入登录密码',
        },
        rules: [
            {
                required: true,
                message: '请输入登录密码',
            },
        ],
    },
    {
        label: '确认密码',
        field: 'confirmPassword',
        component: 'InputPassword',
        dynamicRules: ({ values }) => rules.confirmPassword(values, true),
    },
];
